package com.yootk.po;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;

@Entity
public class Emp {
    @Id
    private Long empno ;
    private String ename ;
    private Double sal ;
    @ManyToOne
    @JoinColumn(name="deptno")
    private Dept dept ;

    public Emp() {
    }

    public Emp(Long empno, String ename, Double sal, Dept dept) {
        this.empno = empno;
        this.ename = ename;
        this.sal = sal;
        this.dept = dept;
    }

    public Long getEmpno() {
        return empno;
    }

    public void setEmpno(Long empno) {
        this.empno = empno;
    }

    public String getEname() {
        return ename;
    }

    public void setEname(String ename) {
        this.ename = ename;
    }

    public Double getSal() {
        return sal;
    }

    public void setSal(Double sal) {
        this.sal = sal;
    }

    public Dept getDept() {
        return dept;
    }

    public void setDept(Dept dept) {
        this.dept = dept;
    }

    @Override
    public String toString() {
        return "【雇员信息】编号：" + this.empno + "，姓名：" + this.ename + "，薪水：" + this.sal ;
    }
}
